refactor: migrate diagLog to unified os.Logger#5
Closed
Newarr wants to merge 1 commit intorefactor/naming-collisionfrom
Closed
refactor: migrate diagLog to unified os.Logger#5Newarr wants to merge 1 commit intorefactor/naming-collisionfrom
Newarr wants to merge 1 commit intorefactor/naming-collisionfrom
Conversation
Replace the legacy `diagLog()` file-based logger (/tmp/openoats.log) with Apple's unified logging system via a centralized `Log` enum. Changes: - Delete `func diagLog(_ msg: String)` from TranscriptionEngine.swift - Create Utils/Logging.swift with centralized Log enum (6 categories) - Replace 69 diagLog calls across 8 files with Log.<category>.<level>() - Normalize all Logger subsystems to com.openoats.app - Remove per-file Logger instances (MicCapture, StreamingTranscriber, WhisperKitManager) in favor of centralized factory - Add privacy annotations: .public for debug values, .private for transcript content, .private(mask: .hash) for file paths - Log levels: debug for hot-path audio callbacks, info for lifecycle events, error for failures, fault for invariant violations 304 tests pass, 0 failures.
Owner
Author
|
Superseded by #7, which contains the cleaned-up squashed logging stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the legacy
diagLog()file logger (/tmp/openoats.log) with Apple's unifiedos.Loggersystem via a centralizedLogenum.Why
diagLogwrites to a flat file on/tmp, bypassing the OS log system. Logs aren't filterable by subsystem, category, or level. They don't show up in Console.app. They persist to disk unconditionally. Three files also used inconsistent Logger subsystems (com.openoatsvscom.openoats.app), fragmenting Console queries.The unified logging system gives: structured filtering (
log stream --predicate 'subsystem == "com.openoats.app"'), per-category visibility, automatic privacy redaction in release builds, and zero disk writes for debug-level logs.How
New file:
Utils/Logging.swiftwith a centralizedLogenum providing 7 static Logger instances (mic, recorder, transcription, streaming, transcript, echo, whisperkit). Single subsystem derived fromBundle.main.bundleIdentifier.69 diagLog calls replaced across 8 files with appropriate log levels:
debugfor high-frequency audio buffer callbacks (gated behind counters to limit volume)infofor lifecycle events (engine start/stop, model loaded, device changed)errorfor failures (file creation, capture errors, model load)faultfor invariant violations (1 case: missing backend)Privacy annotations:
.public.private(redacted in release builds).private(mask: .hash)Per-file Loggers removed from MicCapture, StreamingTranscriber, and WhisperKitManager in favor of the centralized factory.
Testing
swift buildpassesgrep -rc diagLog Sources/returns zero matchesgrep -rn 'Logger(subsystem: "com.openoats"' Sources/returns zero matches (all subsystems normalized)Viewing logs after migration